// 导入 vue-router
import { createRouter, createWebHistory } from "vue-router";

// 使用动态导入组件
const LayoutVue = () => import("@/src-manager/views/layout.vue");
const TicketVue = () => import("@/src-manager/views/operation/ticket.vue");
const LoginVue = () => import("@/src-manager/views/empLogin.vue");
const OrderVue = () => import("@/src-manager/views/operation/Order.vue");
const UserAvatarVue = () => import("@/src-manager/views/employee/UserAvatar.vue");
const UserInfoVue = () => import("@/src-manager/views/employee/UserInfo.vue");
const UserResetPasswordVue = () => import("@/src-manager/views/employee/UserResetPassword.vue");
const ManagerUserVue = () => import("@/src-manager/views/operation/ManagerUser.vue");
const DataStatisticsVue = () => import("@/src-manager/views/operation/DataStatistics.vue");


// 定义路由关系
const routes = [
  {
    path: "/manager/emplogin",
    component: LoginVue,
  },
  {
    path: "/manager",
    component: LayoutVue,
    redirect: "/manager/operation/ticket",
    children: [
      { path: "/manager/operation/ticket", component: TicketVue }, // 移除前面的斜杠
      { path: "/manager/operation/order", component: OrderVue },
      { path: "/manager/employee/manageruser", component: ManagerUserVue },
      { path: "/manager/operation/datastatistics", component: DataStatisticsVue },
      { path: "/manager/employee/avatar", component: UserAvatarVue },
      { path: "/manager/employee/info", component: UserInfoVue },
      { path: "/manager/employee/resetpassword", component: UserResetPasswordVue },
    ],
  },
];

// 创建路由实例
const router = createRouter({
  history: createWebHistory(),
  routes,
});

// 导出路由实例
export default router;
